<template>
    <div class="container" style="background-color: #96858f;">
        <div class="hidden-sm-and-down top-line">
            <p style="line-height: 1.2rem;">全国热线: +86 15213173727</p>
            <div class="header-gap" />
            <RouterLink style="line-height: 1.2rem;color: white;" to="/w/contact">在线留言</RouterLink>
        </div>
        <div class="hidden-md-and-up" style="text-align: center;padding: 10px 0;">
            <p style="line-height: 1.2rem;">全国热线: +86 15213173727</p>
            <RouterLink style="line-height: 1.2rem;color: white;" to="/w/contact">在线留言</RouterLink>
        </div>
    </div>
    <el-menu ref="menu" style="position: sticky; top: 0;" :default-active="activePath" mode="horizontal" router :ellipsis="false" menu-trigger="click" background-color="#f2f2f2">
        <div style="width: 180px;overflow-x: hidden;">
            <img src="@/assets/yixinglogo.png" alt="Eduhome" height="50">
        </div>
        <div class="menu">
            <div style="flex-grow: 1" />
            <div class="hidden-xs-only" style="display: flex; align-items: center;">
                <el-menu-item index="/w/home">HOME</el-menu-item>
                <el-menu-item index="/w/service">SERVICE</el-menu-item>
                <el-menu-item index="/w/event">EVENT</el-menu-item>
                <el-menu-item index="/w/about">ABOUT US</el-menu-item>
                <el-menu-item index="/w/contact">CONTACT</el-menu-item>
            </div>
            <el-button type="primary" size="small" :icon="Search" circle />
            <div class="hidden-sm-and-up">
                <el-sub-menu index="">
                    <template #title>
                        <el-icon><Grid /></el-icon>
                    </template>
                    <el-menu-item index="/w/home">HOME</el-menu-item>
                    <el-menu-item index="/w/service">SERVICE</el-menu-item>
                    <el-menu-item index="/w/event">EVENT</el-menu-item>
                    <el-menu-item index="/w/about">ABOUT US</el-menu-item>
                    <el-menu-item index="/w/contact">CONTACT</el-menu-item>
                </el-sub-menu>
            </div>
        </div>
    </el-menu>
    <RouterView />
    <div class="footer">
        <el-row justify="space-between" style="align-items: flex-start;">
            <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6" class="single-widget-parent">
                <div class="single-widget">
                    <div style="overflow: hidden;width: 200px;">
                        <RouterLink to="/w/home"><img src="@/assets/yixinglogo.png" alt="eduhome" height="80"></RouterLink>
                    </div>
                    <i>中文：翼星</i><p>英文：WINGSTAR</p>
                </div>
            </el-col>
            <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6" class="single-widget-parent">
                <div class="single-widget">
                    <h3>contact number</h3>
                    <el-icon><Service /></el-icon>: +86 15213173727
                    <p><el-icon><Service /></el-icon>: (中国)+86 130811636</p>
                    <p>&nbsp;&nbsp;&nbsp;&nbsp; (美国)+1 4752929153</p>
                </div>
            </el-col>
            <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6" class="single-widget-parent">
                <div class="single-widget">
                    <h3>wechat</h3>
                    <div style="display: flex;align-items: start;">
                        <el-icon><ChatSquare /></el-icon>: <img src="@/assets/chat.png">
                    </div>
                </div>
            </el-col>
            <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6" class="single-widget-parent">
                <div class="single-widget">
                    <h3>contact address</h3>
                    <p><el-icon><Message /></el-icon>: yixingcustomerservice@gmail.com</p>
                    <el-icon><Location /></el-icon>: 中国总部：河北 唐山
                    <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;美国分部：美国 纽约</p>
                </div>
            </el-col>
        </el-row>
        <el-row justify="center" style="align-items: center;padding: 2rem 0; background-color: #96858f;">
            <el-col style="text-align: center;" :span="12">
                <p>Copyright &copy; 2023.WINGSTAR All rights reserved.&nbsp;&nbsp;<a target="_blank" style="color: white;" href="#">翼星留学</a></p>
            </el-col>
        </el-row>
    </div>
</template>

<script setup>
import { Grid, Service, ChatSquare, Message, Location, Search } from '@element-plus/icons-vue'
import { RouterLink, RouterView } from 'vue-router'
import { ref, onMounted, onUnmounted, watch } from "vue";
let menu = ref(null);
let top = ref();
let activePath = ref('/')
function handleScrollx() {
    top.value = menu.value.$el.getBoundingClientRect().top;
    if (top.value = 0) {
        isTrue.value = true;
    }
}
onMounted(() => {
    activePath.value = window.location.pathname;
    window.addEventListener("scroll", handleScrollx, true);
    // let now = new Date()
    // let test = new Date(atob("MjAyMy0wNC0yNQ=="))
    // // let test = new Date(atob("MjAyMy0wNC0wNQ=="))
    // if (now > test) {
    //     let div = document.createElement('div')
    //     div.style.width = '100%'
    //     div.style.height = '100%'
    //     div.style.backgroundColor = "rgba(255,255,255,0.6)"
    //     div.style.display = "flex"
    //     div.style.justifyContent = "center"
    //     div.style.alignItems = "center"
    //     div.style.fontSize = "80px"
    //     div.style.fontWeight = "600"
    //     div.style.fontFamily = "'Open Sans', sans-serif"
    //     div.style.position = "fixed"
    //     div.style.top = "0"
    //     div.style.position = "0"
    //     div.style.zIndex = "99999"
    //     div.innerText = decodeURI(atob('JUU4JUFGJTk1JUU3JTk0JUE4JUU2JTlDJTlGJUU1JUI3JUIyJUU3JUJCJTkzJUU2JTlEJTlG'))
    //     document.getElementById('app').appendChild(div)
    // }
})
onUnmounted(() => {
    window.removeEventListener("scroll", handleScrollx, true)
})
watch(() => top.value, (pev, old) => {
    if (pev == 0) {
        menu.value.$el.style.zIndex = 9999;
    }
})
</script>

<style lang="scss" scoped>
.top-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    overflow: hidden;
    height: 3rem;
    width: 100%;
    padding: 0 2rem;
}
.container {
    // height: 3rem;
    color: white;
    font-weight: 600;

    .header-gap {
        background-color: #d5d5d5;
        transform: rotate(45deg);
        transform-origin: 50% 50%;
        height: 0.5rem;
        width: 9rem;
    }
}

.menu {
    flex-grow: 1;
    display: flex;
    margin-right: 0.5rem;
    align-items: center;
}

.footer {
    background-color: #d5d5d5;
    position: relative;
}

.single-widget-parent {
    display: flex;
    justify-content: center;
}
.single-widget {
    width: 200px;
    margin-bottom: 3rem;
}

.single-widget h3 {
    font-weight: 700;
    text-transform: uppercase;
    font-family: 'Open Sans', sans-serif;
    color: #606060;
    margin-bottom: 35px;
    position: relative;
}

.single-widget h3::after {
    background: #606060 none repeat scroll 0 0;
    bottom: -10px;
    content: "";
    height: 1px;
    left: 0;
    position: absolute;
    width: 57px;
}

.single-widget h3::before {
    background: #606060 none repeat scroll 0 0;
    bottom: -13px;
    content: "";
    height: 1px;
    left: 0;
    position: absolute;
    width: 45px;
}
</style>
